﻿<%@ Control Language="C#" ClassName="BannerControl" %>
<%@ OutputCache Duration="60" VaryByParam="None" %>

<script runat="server">
  protected void Page_Load(object sender, EventArgs e)
  {
    if (!Page.IsPostBack)
    {
      B2C_MALL_HOME ws = new B2C_MALL_HOME();
      ws.Url = ConfigurationManager.AppSettings["B2C_MALL_HOME"].ToString(); 
      string jsonString =
        ws.B2C_MALL_getBanner(ConfigurationManager.AppSettings["WebDeviceid"].ToString()
        , HttpContext.Current.User.Identity.Name);
      JObject restoredObject = JsonConvert.DeserializeObject<JObject>(jsonString);
      string Is_Valid = restoredObject["Is_Valid"].ToString();
      string msg = restoredObject["Msg"].ToString();
      if (Is_Valid == "Y")
      {
        JArray jArray = (JArray)restoredObject["BannerURLary"];
        foreach (var ja in jArray)
        {
          HyperLink link = new HyperLink();
          link.NavigateUrl = ja["bannerLinkURL"].ToString();
          link.ImageUrl = ja["bannerPicURL"].ToString();
          link.Target = "_blank";
          PH_Banners.Controls.Add(link);
        }
      }
    }
  }
</script>

<div class="image-slider JS-slider">
  <div class="image-container">
    <asp:PlaceHolder ID="PH_Banners" runat="server"></asp:PlaceHolder>
    <%--
        <a href="#">
            <img src="Images/banners/KeyBanner/Key1.jpg" alt="#" /></a>
        <a href="#">
            <img src="Images/banners/KeyBanner/Key2.jpg" alt="#" /></a>
        <a href="#">
            <img src="Images/banners/KeyBanner/Key3.jpg" alt="#" /></a>
        <a href="#">
            <img src="Images/banners/KeyBanner/Key4.jpg" alt="#" /></a>
    --%>
  </div>
</div>
